<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    while (true) {
      var counter = prompt('1.加法运算 \n 2.减法运算\n 3.乘法运算\n 4.除法运算\n 5.退出');
      if (counter == '1') {
        var num1 = prompt('请输入第一个数字：');
        var num2 = prompt('请输入第二个数字：');
        num1 = parseInt(num1);
        num2 = parseInt(num2);
        var result = num1 + num2;
        alert('两数之和为：' + result);
        counter = prompt('1.加法运算 \n 2.减法运算\n 3.乘法运算\n 4.除法运算\n 5.退出');
      }
      if (counter == '2') {
        var num1 = prompt('请输入第一个数字：');
        var num2 = prompt('请输入第二个数字：');
        num1 = parseInt(num1);
        num2 = parseInt(num2);
        var result = num1 - num2;
        alert('两数之差为：' + result);
        counter = prompt('1.加法运算 \n 2.减法运算\n 3.乘法运算\n 4.除法运算\n 5.退出');
      }
      if (counter == '3') {
        var num1 = prompt('请输入第一个数字：');
        var num2 = prompt('请输入第二个数字：');
        num1 = parseInt(num1);
        num2 = parseInt(num2);
        var result = num1 * num2;
        alert('两数相乘为：' + result);
        counter = prompt('1.加法运算 \n 2.减法运算\n 3.乘法运算\n 4.除法运算\n 5.退出');
      }
      if (counter == '4') {
        var num1 = prompt('请输入第一个数字：');
        var num2 = prompt('请输入第二个数字：');
        num1 = parseInt(num1);
        num2 = parseInt(num2);
        var result = num1 / num2;
        alert('两数相除为：' + result);
        counter = prompt('1.加法运算 \n 2.减法运算\n 3.乘法运算\n 4.除法运算\n 5.退出');
      }
      if (counter == '5') {
        break;
      }
    }
  </script>
</head>

<body>

</body>

</html>